package org.fast.develop.logicflow.management.builder;


import org.fast.develop.logicflow.repository.domain.deployment.LogicDeployment;
import org.fast.develop.logicflow.management.service.LogicRepositoryService;

/**
 * @author 莫寅
 * @createTime 2022-12-20 00:54
 * @desc：
 */
public class CreateDeploymentBuilder {


    private String key;

    private String category;

    private String name;

    private String modelId;

    private byte[] bytes;

    private LogicRepositoryService repositoryService;

    public CreateDeploymentBuilder(LogicRepositoryService repositoryService) {
        this.repositoryService = repositoryService;
    }

    public CreateDeploymentBuilder key(String key) {
        this.key = key;
        return this;
    }

    public CreateDeploymentBuilder name(String name) {
        this.name = name;
        return this;
    }

    public CreateDeploymentBuilder category(String category) {
        this.category = category;
        return this;
    }

    public CreateDeploymentBuilder modelId(String modelId) {
        this.modelId = modelId;
        return this;
    }

    public CreateDeploymentBuilder bytes(byte[] bytes) {
        this.bytes = bytes;
        return this;
    }

    public LogicDeployment deploy(){
        return repositoryService.deploy(this);
    }

    public String getKey() {
        return key;
    }

    public String getName() {
        return name;
    }

    public String getCategory() {
        return category;
    }

    public String getModelId() {
        return modelId;
    }

    public byte[] getBytes() {
        return bytes;
    }
}
